package com.hk.enums;

import cn.hutool.core.util.StrUtil;
import lombok.Getter;

/**
 * @author 20231
 */

@Getter
public enum PictureEditActionEnum {

    ZOOM_IN("放大操作", "ZOOM_IN"),
    ZOOM_OUT("缩小操作", "ZOOM_OUT"),
    ROTATE_LEFT("左旋操作", "ROTATE_LEFT"),
    ROTATE_RIGHT("右旋操作", "ROTATE_RIGHT");

    private final String value;
    private final String code;

    PictureEditActionEnum(String value, String code) {
        this.value = value;
        this.code = code;
    }

    /**
     * 根据 code 获取枚举
     */
    public static PictureEditActionEnum getEnumByCode(String code) {
        if (StrUtil.isBlank(code)) {
            return null;
        }
        for (PictureEditActionEnum actionEnum : PictureEditActionEnum.values()) {
            if (actionEnum.code.equals(code)) {
                return actionEnum;
            }
        }
        return null;
    }
}
